<template>
	<!-- 导航组 -->
	<view class="diy-navBar" :style="[{'background': background}]">
		<view class="data-list" :class="['avg-sm-'+itemStyle.rowsNum]">
			<view class="item-nav" v-for="dataItem in dataList" :key="dataItem.goods_id">
				<view class="nav-to" @tap="menuClick" :data-url="dataItem.linkUrl">
					<view class="item-image">
						<image mode="widthFix" :src="dataItem.imgUrl"></image>
					</view>
					<view class="item-text f-28 onelist-hidden" :style="[{'color': color}]">{{ dataItem.text }}</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		computed: {
			background() {
				return this.itemStyle.background;
			},
			color() {
				return this.itemStyle.color;
			}
		},
		props: {
			// itemIndex:{},
			itemStyle: {},
			params: {},
			dataList: {}
		},
		methods: {
			//跳转
			menuClick(e) {
				let url = e.currentTarget.dataset.url;
				// console.log(url);
				this.navigationTo({
					//只能跳转到程序内页面
					url: url
				});
			},
		}
	}
</script>
<style>
	/* common.wxss */
	@import url("../../utils/common.scss");

	/* 导航组 */

	.diy-navBar .data-list::after {
		clear: both;
		content: " ";
		display: table;
	}

	.diy-navBar .item-nav {
		float: left;
		margin: 20upx 0;
		text-align: center;
	}

	.diy-navBar .item-nav .item-image {
		margin-bottom: 8upx;
		font-size: 0;
	}

	.diy-navBar .item-nav image {
		width: 88upx;
		height: 88upx;
	}

	/* 分列布局 */

	.diy-navBar .avg-sm-3>.item-nav {
		width: 33.33333333%;
	}

	.diy-navBar .avg-sm-4>.item-nav {
		width: 25%;
	}

	.diy-navBar .avg-sm-5>.item-nav {
		width: 20%;
	}
</style>
